added samples
[windows-sources.git] / sdk / samples / all in on code / Visual Studio 2008 / CSWebBrowserSuppressError / WebBrowser2EventHelper.cs
blobcfddb74be9d0f6efc1e743cc7a13df1cc9dfde0b
1 /****************************** Module Header ******************************\
2 * Module Name: WebBrowser2EventHelper.cs
3 * Project: CSWebBrowserSuppressError
4 * Copyright (c) Microsoft Corporation.
5 *
6 * The class WebBrowser2EventHelper is used to handles the NavigateError event
7 * from the underlying ActiveX control by raising the NavigateError event
8 * defined in class WebBrowserEx.
9 *
10 * Because of the protected method WebBrowserEx.OnNavigateError, this
11 * class is defined inside the class WebBrowserEx.
13 * This source is subject to the Microsoft Public License.
14 * See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
15 * All other rights reserved.
17 * THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
18 * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
20 \***************************************************************************/
22 using System;
23 using System.Runtime.InteropServices;
25 namespace CSWebBrowserSuppressError
27 public partial class WebBrowserEx
29 private class WebBrowser2EventHelper : StandardOleMarshalObject, DWebBrowserEvents2
31 private WebBrowserEx parent;
33 public WebBrowser2EventHelper(WebBrowserEx parent)
35 this.parent = parent;
38 /// <summary>
39 /// Raise the NavigateError event.
40 /// If a instance of WebBrowser2EventHelper is associated with the underlying
41 /// ActiveX control, this method will be called When NavigateError event was
42 /// fired in the ActiveX control.
43 /// </summary>
44 public void NavigateError(object pDisp, ref object url,
45 ref object frame, ref object statusCode, ref bool cancel)
48 // Raise the NavigateError event in WebBrowserEx class.
49 this.parent.OnNavigateError(new WebBrowserNavigateErrorEventArgs(
50 (String)url, (String)frame, (Int32)statusCode, cancel));